fix(picker): align datetime column consistently in time-based pickers#413
Closed
hermandavid wants to merge 1 commit into
Closed
fix(picker): align datetime column consistently in time-based pickers#413hermandavid wants to merge 1 commit into
hermandavid wants to merge 1 commit into
Conversation
The time column in session and timeline pickers had two alignment issues causing the datetime to render partially or fully off-screen, especially when a preview pane was active. Per-item variable width: each row computed its own time column width from format_time(timestamp), producing different widths for same-day (e.g. '10:35') vs older entries (e.g. '09 Jun 2024 10:35'). Fixed by using format_time(0) to derive the maximum column width from the longest possible output (different-year format). Shorter time strings are right-padded within the fixed column. Separator double-counting: the +1 in time_width and debug_width was intended for the separator between parts, but to_string() and to_formatted_text() already add their own separators. This caused rows to exceed item_width by 1-2 chars, pushing the time column past the visible pane edge. Fixed by accounting for separators explicitly. Unreliable fzf width_callback: the start:+transform callback read FZF_PREVIEW_COLUMNS to compute list pane width, but this env var could be 0 or absent at fzf start time. When missing, format_width fell back to the full window width, formatting items much wider than the visible list pane. Removed this mechanism in favor of the M.pick-level format_width which already accounts for the preview split ratio.
Owner
Contributor
|
This will move me back to #402 (comment). The date is not a issue for me tbh... fzf have the ability to The issue here is its real width cannot be really determined until fzf buffer is created and we get access from these variable |
Contributor
Author
|
I'll look into it and try to come up with some robust solution working in general. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Issue
The time column in session and timeline pickers was sized from each item's own timestamp, so recent sessions showing
10:35and older ones showing09 Jun 2024 10:35had different column widths per row — datetimes were misaligned and older entries overflowed the visible pane with FZF picker.Solution
The time column is now sized from the widest timestamp in the current item list, computed once when the picker opens. If all sessions are from today the column is compact; if older sessions are present it expands to fit. On picker reopen the width recomputes from the then-current list.
Primarily targets fzf-lua. The column width and separator fixes apply to all backends.
Tested with fzf-lua, Snacks, and Telescope.